/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cmp.screens;

import com.cmp.arena.Arena;
import com.cmp.arena.CameraFactory;
import com.cmp.core.Main;
import com.cmp.player.PlayerFactory;
import com.jme3.scene.Node;

/**
 * Select a character in this screen.
 * @author Krummer
 */
public class CharacterSelectScreen extends ScreenAppController {
    
    private PlayerFactory.Role roleSelection;

    /* button controls */
    public void pickCarrier() {
        this.roleSelection = PlayerFactory.Role.CARRIER;
        this.nextScreen();
    }
    
    public void pickSupporter() {
        this.roleSelection = PlayerFactory.Role.SUPPORTER;
        this.nextScreen();
    }
    
    public void pickBrawler() {
        this.roleSelection = PlayerFactory.Role.BRAWLER;
        this.nextScreen();
    }
    
    /*
     * Role has been selected, make the character and switch screens.
     */
    private void nextScreen() {
        Arena arena = this.getApp().getStateManager().getState(Arena.class);
        Node player = new Node("Player One Bitches");
        PlayerFactory.makePlayer(player, true, this.roleSelection,false, this.getApp().getAssetManager());
        arena.addNode(player);
        
        //attach a camera.
        Node cameraNode = new Node("CameraNode");
        arena.getMapNode().attachChild(cameraNode);
        CameraFactory.makeCamera(cameraNode, player, Main.app.getCamera());

        this.getNifty().gotoScreen("game");
    }
}
